<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<div id="sortlist" class="m rank">
	<div class="mt">
		<h2>推荐产品</h2>
	</div>
	<div class="mc" id="adv" style="height: 486px;">
		<ul>
		</ul>
	</div>
	<script type="text/javascript">
		$(document).ready(function(){
			var mod_id="${mod_id}";
			$.ajax({
				async: false,
				type: "POST",
				dataType: "json",
				url: "Advertising.do",
				data: "method=adv&mod_id="+mod_id,
				error: function(request, settings) {/*alert("数据请求失败！"); */},
				success: function(data) {
					var li_html="";
					$.each(data, function(i,item){
						li_html=li_html+
						'<li><span></span><div class="p-img">'+
						'<a target="_blank" href="'+item.target_url+'">'+
						'<img style="width:115px;height:79px; border: 1px solid #DEDEDE; padding: 1px;" alt="'+item.title+'" src="'+item.img_url+'">'+
						'</a></div><div class="p-name"><a target="_blank" href="'+item.target_url+'">'+item.title+'</a></div><div class="p-price">'+item.model+'</div></li>';	
						$("#adv ul").html(li_html);
					});
				}
			});
			$("#adv ul li:first-child").addClass("fore");
			if($("#adv ul li").length>5){
				$("#adv ul li").each(function(i){
					if(i>4){
						$(this).css("dispaly","none");
					}
				});
				window.setInterval(showAdv,5000); 
			}
		});
		
		function showAdv(){
			$("#adv ul li:first-child").next().addClass("fore");
			$("#adv ul li:first-child").hide("slow",function(){
				var li_html="<li style=\"display: none\">"+$("#adv ul li:first-child").html()+"</li>";
				$("#adv ul li:first-child").remove();
				$("#adv ul").append(li_html);
			});
			$("#adv ul li:last-child").show("slow");
		}
	</script>
</div>
<li>
	<a>
		<img alt="" style="margin-left: 7px;margin-top: 10px;"
	src="${ctx}/css/images/mssj_new.png">
	</a>
</li>
<li>
    <a href="${ctx}/ConnectUs.do?mod_id=2100" target="_blank">
    	<img alt="" style="margin-left: 7px;margin-top: 5px;" src="${ctx}/css/images/lxwm_new.png">
    </a>
</li>